package com.example.demo.Dao;

import com.example.demo.Model.Book;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class BookDao {
    public List<Book> mockDate() {
        List<Book> list = new ArrayList<>();
        for (int i = 0; i < 15; i++) {
            Book book = new Book();
            book.setId(i);
            book.setBookName("图书" + i);
            book.setNum(new Random().nextInt(100));
            book.setPrice(new BigDecimal(new Random().nextInt(100) + 10));
            book.setAuthor("作者" + i);
            book.setPublishName("出版社" + i);
            book.setStatus(i % 5 == 0 ? 1 : 0);
            if (book.getStatus() == 0) {
                book.setStatusCN("可借阅");
            }else {
                book.setStatusCN("不可借阅");

            }
            list.add(book);
        }
        return list;
    }
}
